cmake_minimum_required(VERSION 3.10)

project(FrameWork LANGUAGES CXX C)

include(GenerateExportHeader)







if(NOT CMAKE_BUILD_TYPE)
      set(CMAKE_BUILD_TYPE Release)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
      set(SYSTEM_NAME Win32)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
      set(SYSTEM_NAME MacOS)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
      set(SYSTEM_NAME Linux)
endif()

set(PREFIX_DIR "build/${SYSTEM_NAME}/${BUILD_PLATFORM}/${CMAKE_BUILD_TYPE}")

message(STATUS "[${PROJECT_NAME}] PREFIX_DIR:${PREFIX_DIR}")

set(PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR})

# 配置Qt
set(CMAKE_PREFIX_PATH "D:/Qt/Qt5.14.0/5.14.0/mingw73_64")

set(CMAKE_INCLUDE_CURRENT_DIR ON)

# 自动生成moc文件和rcc文件
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)



# 开启C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 生成编译命令文件
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)




find_package(Qt6 COMPONENTS Core Widgets Gui QUIET)

if(Qt6_FOUND)
 message(STATUS "[${PROJECT_NAME}] Qt6_FOUND: ${Qt6_FOUND}")
 set(QT_VERSION 6)
else()
  message(WARNING "[${PROJECT_NAME}] Qt6 not found")
 set(QT_VERSION 5)
 find_package(Qt${QT_VERSION} COMPONENTS Core Widgets Gui REQUIRED)
endif()




list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(FunctionAPI)

add_subdirectory(Common)

add_subdirectory(Forms)

add_subdirectory(App)